﻿/*----------------------------------------------------------------
//  <copyright file="SqliteEntityFrameworkCorePack.cs" company="MicroCloud@151504200868">
//      Copyright © 2020-2024 MicroCloud Corporation, All rights reserved.
//  </copyright>
//  <site>https://gitee.com/chenmm123/microclouds</site>
//  <last-editor>cmm</last-editor>
//  <last-date>2022-11-30 14:53</last-date>
//----------------------------------------------------------------*/

namespace MicroCloud.Entity.Sqlite
{
    #region "Sqlite实体框架核心模块(SqliteEntityFrameworkCore)"
    /// <summary>
    /// Sqlite实体框架核心模块(SqliteEntityFrameworkCore)
    /// </summary>
    [Description("Sqlite实体框架核心模块(SqliteEFCore)")]
    public class SqliteEntityFrameworkCorePack : EntityFrameworkCorePackBase
    {
        #region "属性"
        #region "获取 模块级别"
        /// <summary>
        /// 获取 模块级别
        /// </summary>
        public override PackLevel Level => PackLevel.Framework;
        #endregion
        #region "获取 模块启动顺序编号"
        /// <summary>
        /// 获取 模块启动顺序编号，模块启动的顺序先按级别启动，级别内部再按此顺序启动
        /// </summary>
        public override int OrderNo => 1;
        #endregion
        #region "获取 数据库类型"
        /// <summary>
        /// 获取 数据库类型
        /// </summary>
        protected override DatabaseType DatabaseType => DatabaseType.Sqlite;
        #endregion

        #endregion

        #region "方法"
        #region "将模块服务添加到依赖注入服务容器中"
        /// <summary>
        /// 将模块服务添加到依赖注入服务容器中
        /// </summary>
        /// <param name="services">依赖注入服务容器</param>
        /// <returns></returns>
        public override IServiceCollection AddServices(IServiceCollection services)
        {
            services = base.AddServices(services);

            services.AddSingleton<ISequentialGuidGenerator, SqliteSequentialGuidGenerator>();
            services.AddScoped(typeof(ISqlExecutor<,>), typeof(SqliteDapperSqlExecutor<,>));
            services.AddSingleton<IDbContextOptionsBuilderDriveHandler, SqliteDbContextOptionsBuilderDriveHandler>();

            return services;
        }
        #endregion

        #endregion

    }
    #endregion

}
